<?php
/**
 * Zap! Framework
 *
 * LICENSE: This framework is subject under the new BSD license that is available through the
 * world-wide-web at the following URI: http://opensource.org/licenses/BSD-3-Clause.
 *
 * @author Andie Valderama <andie.valderama@gmail.com>
 * @license http://opensource.org/licenses/BSD-3-Clause New BSD License
 * @link http://code.google.com/p/zap-framework/
 * @since File available since release 0.0.1
 */

/*Enforces strict error reporting when the application is running on localhost.*/
$localhost = $_SERVER['SERVER_NAME'] == '127.0.0.1' || $_SERVER['SERVER_NAME'] == 'localhost' || substr($_SERVER['SERVER_NAME'],0,3) == '192';

ini_set('display_errors', $localhost);

error_reporting(E_ALL|E_STRICT);

/*Allows IE to accept SESSIONS, comment if it creates conflicts.*/
if (!headers_sent() && strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
    header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
}


/*Build global variables for document root path and server path.*/
$prefix = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';

if (file_exists('.htaccess')) {
    $url = $prefix . $_SERVER['HTTP_HOST'] . '/';
} else {
    $uri = explode('index.php', $_SERVER['REQUEST_URI']);
    $url = $prefix . $_SERVER['HTTP_HOST'] . $uri[0] . 'index.php/';
}

/*Define the server path.*/
define('URL', $url);

/*Define the document root path.*/
define('ROOT', dirname(__FILE__) . '/');


/*Load the configuration class.*/
require_once ROOT . 'core/zapConfiguration.class.php';

/*Start the application.*/
$app = new zapConfiguration();
